home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
HardwareContext-sparc.h,v
< prev
next >
Wrap
Text File
|
1990-06-28
|
4KB
|
202 lines
head 1.3;
branch ;
access ;
symbols ;
locks grunwald:1.3; strict;
comment @ * @;
1.3
date 90.06.28.14.46.50; author grunwald; state Exp;
branches ;
next 1.2;
1.2
date 90.06.08.17.42.43; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 90.06.08.17.27.21; author grunwald; state Exp;
branches ;
next ;
desc
@@
1.3
log
@*** empty log message ***
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#ifndef HardwareContext_h
#define HardwareContext_h
#pragma once
#include <stream.h>
#include <assert.h>
#include <AwesimeConfig.h>
#include <setjmp.h>
extern long MagicStackMarker;
typedef void (*voidFuncP)();
class CpuMultiplexor;
class SingleCpuMux;
class MultiCpuMux;
class SimulationMultiplexor;
class SingleSimMux;
typedef unsigned long HardwareContextQuad;
#define HARDWARE_CONTEXT_CHECK_NONE 0
#define HARDWARE_CONTEXT_CHECK_SWITCH 1
#define HARDWARE_CONTEXT_CHECK_MPROTECT 2
class HardwareContext {
//
// The following two fields are machine dependent & their order
// should not be changed.
//
HardwareContextQuad sp;
HardwareContextQuad INs[8];
HardwareContextQuad LOCALs[8];
HardwareContextQuad pc;
HardwareContextQuad out0;
void** stackBase; // bottom of stack
void** stackEnd; // maximum depth of stack? (actually, a MIN value)
unsigned stackMax; // maximum depth of stack? (actually, a MIN value)
unsigned stackSize; // stack size in units of void*
void** stackMallocAt;
//
// point to MagicStackMarker to check for corruption
//
long *stackCheck;
unsigned checkStackLimits;
friend class Thread;
friend class CpuMultiplexor;
friend class SingleCpuMux;
friend class MultiCpuMux;
friend class SimulationMultiplexor;
friend class SingleSimMux;
//
// Accessed by friend classes only
//
void switchContext(HardwareContext *to);
void magicSwitchTo(HardwareContext *to);
void **getSp();
void **mallocAt();
void buildReturnFrame(void * returnThis, voidFuncP returnAddress);
void stackOverflow();
//
// never allocated by anything other than friend classes
//
HardwareContext(int checked, unsigned stackSize);
void reclaimStack();
public:
HardwareContext();
long maxStackDepth();
void checkStack(int overage = 0);
void classPrintOn(ostream& strm);
};
static inline
HardwareContext::HardwareContext()
{
int NotReached = 0;
assert( NotReached );
}
static inline ostream&
operator<<(ostream& strm, HardwareContext& ob)
{
ob.classPrintOn(strm);
return strm;
}
static inline long
HardwareContext::maxStackDepth()
{
return( long(stackMax) );
}
static inline void **
HardwareContext::getSp()
{
register int theStackPointer asm("%sp");
return( (void **) theStackPointer );
}
static inline void
HardwareContext::checkStack(int overage)
{
unsigned depth = stackBase - getSp() + overage;
if (stackMax < depth) {
stackMax = depth;
}
if ( stackMax >= stackSize || *stackCheck != MagicStackMarker ) {
stackOverflow();
}
}
#endif HardwareContext_h
@
1.2
log
@*** empty log message ***
@
text
@d28 4
a74 1
void buildHiddenReturnFrame(void * returnThis, voidFuncP returnAddress);
d82 2
d118 1
@
1.1
log
@Initial revision
@
text
@d16 1
a16 1
extern const long MagicStackMarker;
a33 1
HardwareContextQuad fp;
d35 3
a37 1
#if 0
d39 1
a39 4
#else
HawareContextQuad IN[8];
HawareContextQuad LOCAL[8];
#endif
@